package com.neuedu.service.registration.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.bean.Register;
import com.neuedu.bean.RestBean;
import com.neuedu.mapper.RegisterMapper;
import com.neuedu.service.registration.RegisterService;
@Service
public class RegisterServiceImpl implements RegisterService {
    @Autowired
	private RegisterMapper rm;
	@Override
	public String addRegister(Register register) {
		// TODO Auto-generated method stub
		Integer result=rm.insert(register);
		if (result>0) {
			return "挂号成功";
		}
		return "挂号失败";
	}

	@Override
	public String getAlreadyRegisterCount(String visitDate, String noon, String employeeId) {
		// TODO Auto-generated method stub
		QueryWrapper<Register> qw=new QueryWrapper<>();
		qw.eq("employee_id", employeeId)
		.eq("date(visit_date)", visitDate)
		.eq("noon", noon)
		.lt("visit_state", 4);
//		MyBatisPlus计数返回的是长整型数值
		Long result=rm.selectCount(qw);
		return result.toString();
	}

	@Override
	public RestBean refundMedicalRecord(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getMaxCaseNumber() {
		// TODO Auto-generated method stub
		Integer result=1+Integer.parseInt(rm.getMaxCaseNumber());
		return result.toString();
	}

	@Override
	public RestBean getRecordRefundPatient(String caseNumber, String realName, Integer nowPageNumber,
			Integer pageSize) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public RestBean treatPatient(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

}
